﻿using System;
using System.Collections.Generic;
using System.Web.Profile;
using GoShopping.Model;

/// <summary>
/// Profile数据类
/// </summary>
public class ProfileData : ProfileBase
{

}
[Serializable]
public class RecentPrdts
{
    public RecentPrdts()
    { }

    /// <summary>
    /// 最近浏览商品
    /// </summary>
    private List<RecentPrdt> recentGoods = new List<RecentPrdt>();
    /// <summary>
    /// 最近浏览商品
    /// </summary>
    public List<RecentPrdt> RecentGoods
    {
        get 
        {
            List<RecentPrdt> recent = new List<RecentPrdt>();
            for (int i = 0; i < recentGoods.Count; i++)
            {
                recent.Add(recentGoods[recentGoods.Count - i - 1]);                
            }
            return recent;
        }
        set { recentGoods = value; }
    }

    public bool AddRecent(RecentPrdt fg)
    {
        if (!IsExist(fg.RecentId))
        {
            recentGoods.Add(fg);
            return true;
        }
        return false;
    }

    public bool IsExist(string id)
    {
        for (int i = 0; i < RecentGoods.Count; i++)
        {
            if (RecentGoods[i].RecentId == id)
            {
                return true;
            }
        }
        return false;
    }
    public void DelRecent(RecentPrdt recentPrdt)
    {
        recentGoods.Remove(recentPrdt);
    }
}
[Serializable]
public class RecentPrdt
{
    private string recentId;

    public string RecentId
    {
        get { return recentId; }
        set { recentId = value; }
    }

    private string recentName;

    public string RecentName
    {
        get { return recentName; }
        set { recentName = value; }
    }

    private decimal recentPrice;

    public decimal RecentPrice
    {
        get { return recentPrice; }
        set { recentPrice = value; }
    }

    private string src;

    public string Src
    {
        get { return src; }
        set { src = value; }
    }
}


///// <summary>
///// Profile数据类
///// </summary>
//public class ProfileData : ProfileBase
//{
//    /// <summary>
//    /// 最近浏览商品
//    /// </summary>
//    private IList<Product> _LatestViewGoods;
//    /// <summary>
//    /// 最近浏览商品
//    /// </summary>
//    public IList<Product> LatestViewGoods
//    {
//        get { return _LatestViewGoods; }
//        set { _LatestViewGoods = value; }
//    }
//}

//[Serializable]
//public class FavouriteGoods
//{
//    private List<string> _LatestGoodsId = new List<string>();

//    public List<string> LatestGoodsId
//    {
//        get { return _LatestGoodsId; }
//        set { _LatestGoodsId = value; }
//    }
//}